import request from '@/utils/request'

/*
* 楼栋
* */
// 楼栋管理初始化
export function initBuildingManage(query) {
  return request({
    url: '/gcxt/building/init',
    method: 'get',
    params: query
  })
}

// 查询楼栋列表
export function listBuildingManage(query) {
  return request({
    url: '/gcxt/building/list',
    method: 'get',
    params: query
  })
}

// 新增楼栋
export function addBuildingManage(data) {
  return request({
    url: '/gcxt/building/add',
    method: 'post',
    data: data
  })
}

// 修改楼栋
export function updateBuildingManage(data) {
  return request({
    url: '/gcxt/building/edit',
    method: 'post',
    data: data
  })
}

// 删除楼栋
export function delBuildingManage(id) {
  return request({
    url: '/gcxt/building/delete',
    method: 'delete',
    data: { fid: id }
  })
}

// 查询楼栋树形（楼栋+单元）列表
export function treeBuildingManage(query) {
  return request({
    url: '/gcxt/building/tree',
    method: 'get',
    params: query
  })
}

// 查询有房间的楼栋树形（楼栋+单元）
export function buildingTreeWithRoom(query) {
  return request({
    url: '/gcxt/building/treeRoom',
    method: 'get',
    params: query
  })
}

// 删除附件
export function delFile(fileId) {
  return request({
    url: '/gcxt/building/deleteFile/' + fileId,
    method: 'post',
    timeout: 60000
  })
}

// 附件列表
export function listFile(buildingId) {
  return request({
    url: '/gcxt/building/fileList',
    method: 'get',
    params: { buildingId: buildingId }
  })
}
